import Vue from "vue";//导入vue
import Router from "vue-router";//导入路由器
import Home from "@/pages/home";//首页
import Category from "@/pages/sort";//分类
import Cart from "@/pages/car";//购物车
import My from "@/pages/my";//我的
import Product from '@/pages/product';//商品详情

Vue.use(Router);//将路由器对象合并到Vue对象上

//声明一个routes对象用于配置页面路径
const routes = [
	{
		path:"/",//应用默认要显示的页面
		name:"Home",
		component:Home,
		title:"易果生鲜"
	},
	{
		path:"/category/",//应用默认要显示的页面
		name:"Category",
		component:Category,
		title:"商品类型"
	},
	{
		path:"/cart/",//应用默认要显示的页面
		name:"Cart",
		component:Cart,
		title:"购物车"
	},
	{
		path:"/my/",//应用默认要显示的页面
		name:"My",
		component:My,
		title:"个人中心"
	},{
		path:"/product/:typeId/:goodsId",
		name:"Product",
		component:Product,
		title:"商品详情"
	}
];

//创建路由器实例
const router = new Router({
	linkActiveClass:'active-nav',//配置路由激活样式
	routes
});

//导出router实例
export default router;